#!/bin/bash

set -ex

poetry version "$@"
version="$(poetry version -s)"

# write new setup.py file
poetry build --format sdist
tar -xvf dist/*-${version}.tar.gz -O '*/setup.py' > setup.py

git add .
git commit -m "Version ${version}"
git tag "${version}"
git push
git push --tags
poetry build
poetry publish
